package com.meida.paotui.bus.provider.controller;

import com.meida.common.mybatis.model.*;
import com.meida.common.springmvc.base.BaseController;
import com.meida.paotui.bus.client.entity.BusGoodsorder;
import com.meida.paotui.bus.provider.service.BusGoodsorderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 订单表控制器
 *
 * @author flyme
 * @date 2019-11-12
 */
@RestController
@RequestMapping("/bus/goodsorder/")
public class BusGoodsorderController extends BaseController<BusGoodsorderService, BusGoodsorder>  {

    @ApiOperation(value = "订单表-分页列表", notes = "订单表分页列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map map) {
        return bizService.pageList(map);
    }

    @ApiOperation(value = "订单表-列表", notes = "订单表列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "list")
    public ResultBody list(@ModelAttribute(value = "listModel") ListModel listModel) {
        return bizService.listEntityMap(listModel);
    }

    @ApiOperation(value = "订单表-添加", notes = "添加订单表")
    @PostMapping(value = "save")
    public ResultBody save(@ModelAttribute(value = "updateModel") SaveModel saveModel) {
        return bizService.add(saveModel);
    }

    @ApiOperation(value = "订单表-更新", notes = "更新订单表")
    @PostMapping(value = "update")
    public ResultBody update(@ModelAttribute(value = "updateModel") UpdateModel updateModel) {
        return bizService.edit(updateModel);
    }

    @ApiOperation(value = "订单表-删除", notes = "删除订单表")
    @PostMapping(value = "delete")
    public ResultBody delete(@ModelAttribute(value = "deleteModel") DeleteModel deleteModel) {
        return bizService.delete(deleteModel);
    }


    @ApiOperation(value = "订单表-详情", notes = "订单表详情")
    @GetMapping(value = "get")
    public ResultBody get(@ModelAttribute(value = "getModel") GetModel getModel) {
        return bizService.get(getModel);
    }

    @ApiOperation(value = "订单表-更新状态值", notes = "订单表更新某个状态字段")
    @PostMapping(value = "setState")
    public ResultBody setState(@RequestParam(required = false) Map map, @RequestParam(value = "state") Integer state) {
            return bizService.setState(map, "state", state);
    }
}
